package org.example.erp.controller;

import org.example.erp.domain.SalesList;
import org.example.erp.service.impl.SalesListServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class SalesListController {
    @Autowired
    private SalesListServiceImpl salesListService;
    @PostMapping("/salesLists/insert")
    public DataResult Insert(@RequestBody SalesList s) {
        try {
            salesListService.save(s);
            return DataResult.success(); // 确保返回成功结果
        } catch (Exception e) {
            return DataResult.success("新增失败：" + e.getMessage()); // 错误处理
        }
    }
}
